package com.integralPerformance.controller;

import com.integralPerformance.common.Result;
import com.integralPerformance.pojo.form.add.AddApplicationRecode;
import com.integralPerformance.pojo.form.update.UpdateApplicationRecode;
import com.integralPerformance.pojo.query.ApplicationManagerQuery;
import com.integralPerformance.pojo.query.ApplicationRecodeQuery;
import com.integralPerformance.pojo.query.ApplicationRecodeTeacherQuery;
import com.integralPerformance.pojo.vo.ApplicationManagerVo;
import com.integralPerformance.pojo.vo.ApplicationRecodesVo;
import com.integralPerformance.pojo.vo.BaseVo;
import com.integralPerformance.service.impl.ApplicationRecodesServiceImpl;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/s2/applicationRecodes")
@Tag(name = "！新：岗位申请信息审核记录表", description = "岗位申请信息审核记录表")
public class ApplicationRecodesController {

    @Autowired
    ApplicationRecodesServiceImpl applicationRecodesService;

    @Operation(summary = "管理员：查询获取", description = "查询获取")
    @PostMapping("/getList")
    public Result<BaseVo<ApplicationRecodesVo>> getList(@RequestBody ApplicationRecodeQuery applicationRecodeQuery) {
        return applicationRecodesService.getList(applicationRecodeQuery);
    }

    @Operation(summary = "教师：添加岗位申请", description = "教师：添加岗位申请")
    @PostMapping("/addOne")
    public Result<String> addOne(@RequestBody AddApplicationRecode addApplicationRecode) {
        return applicationRecodesService.addOne(addApplicationRecode);
    }

    @Operation(summary = "教师：修改岗位申请", description = "教师：修改岗位申请")
    @PostMapping("/update")
    public Result<String> update(@RequestBody UpdateApplicationRecode updateApplicationRecode) {
        return applicationRecodesService.updateOne(updateApplicationRecode);
    }

    @Operation(summary = "教师：查询获取", description = "教师：查询获取")
    @PostMapping("/getByTeacherId/{teacherId}")
    public Result<BaseVo<ApplicationRecodesVo>> getByTeacherId(@RequestBody ApplicationRecodeTeacherQuery applicationRecodeTeacherQuery, @PathVariable String teacherId) {
        return applicationRecodesService.getByTeacherId(applicationRecodeTeacherQuery,teacherId);
    }

    @Operation(summary = "教师：删除", description = "教师：删除，只允许未被审核通过的数据进行删除，并且是自己才能删除自己的")
    @DeleteMapping("/deleteById/{teacherId}/{id}")
    public Result<String> deleteById(@PathVariable String id, @PathVariable String teacherId) {
        return applicationRecodesService.deleteById(id,teacherId);
    }

    @Operation(summary = "管理员：批量审核通过", description = "管理员：批量审核通过")
    @PostMapping("/agreeByIds")
    public Result<String> agreeByIds(@RequestBody List<Integer> list) {
        return applicationRecodesService.agreeByIds(list);
    }

    @Operation(summary = "管理员：批量审核退回", description = "管理员：批量审核退回")
    @PostMapping("/disagreeByIds")
    public Result<String> disagreeByIds(@RequestBody List<Integer> list) {
        return applicationRecodesService.disagreeByIds(list);
    }



}
